{set:$user = $this->user}
{set:$myCartObj = new Cart(); $myCartInfo = $myCartObj->getMyCart();$siteConfig=new Config("site_config");}
{set:$siteConfigObj = new Config("site_config");$site_config   = $siteConfigObj->getInfo();}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{echo:$siteConfig->name}</title>
<link type="image/x-icon" href="favicon.ico" rel="icon">
<link type="image/x-icon" href="favicon.ico" rel="bookmark">
<link rel="stylesheet" href="{skin:css/index.css}" />
<link rel="stylesheet" href="{skin:css/jquery.jqzoom.css}" />
{js:jquery}
{js:form}
{js:validate}
{js:dialog}
<script type='text/javascript' src="{theme:javascript/common.js}"></script>
<script type='text/javascript' src="{url:/javascript/adloader/}"></script>
<link rel="stylesheet" type="text/css" href="{skin:}jquery.bxSlider/bx_styles/bx_styles.css" />
</head>
<body class="index">
<div class="container">
	<div class="header">
		<h1 class="logo"><a title="{echo:$siteConfig->name}" style="background:url({webroot:image/logo.gif});" href="{url:}">{echo:$siteConfig->name}</a></h1>
		<ul class="shortcut">
			<li class="first"><a href="{url:/ucenter/index}">我的账户</a></li><li><a href="{url:/ucenter/order}">我的订单</a></li><li class='last'><a href="{url:/site/help_list}">使用帮助</a></li>
		</ul>
		<p class="loginfo">
			{if:(isset($user['user_id']) && $user['user_id']!='')}{$user['username']}您好，欢迎您来到{echo:$siteConfig->name}购物！[<a href="{url:/simple/logout}" class="reg">安全退出</a>]{else:}[<a href="{url:/simple/login}">登录</a>
			{set:$callback = IReq::get('callback')}
			{if:$callback==""}
			<a class="reg" href="{url:/simple/reg}">免费注册</a>
			{else:}
			{set:$callback=urlencode($callback);}
			<a class="reg" href="{url:/simple/reg/?callback=$callback}">免费注册</a>
			{/if}
			]
			{/if}
		</p>
	</div>
	<div class="navbar">
		<ul>
			<li><a href="{url:}">首页</a></li>
			{set:$i=0;}
			{query:name=guide}
			{set:$i++;$item['link']=IUrl::creatUrl($item['link']);}
			<li {if:$i==count($items)}style="background:none;"{/if}><a href="{$item['link']}">{$item['name']}<span> </span></a></li>
			{/query}
		</ul>

		<div class="mycart">
			<dl>
				<dt><a href="{url:/simple/cart}">购物车<b name="mycart_count">{$myCartInfo['count']}</b>件</a></dt>
				<dd><a href="{url:/simple/cart}">去结算</a></dd>
			</dl>

			<!--购物车浮动div 开始-->
			<div class="shopping" id='div_mycart' style='display:none;'>
			</div>
			<!--购物车浮动div 结束-->

		</div>
	</div>

	<div class="searchbar">
		<div class="allsort">
			<a href="javascript:void(0);">全部商品分类</a>

			<!--总的商品分类-开始-->
			<ul class="sortlist" id='div_allsort' style='display:none'>
				{set:$this->goodsCategory = block::goods_category();}
				{foreach:items = $this->goodsCategory item = $first}
					<li>
						<h2><a href="{url:/site/pro_list/cat/$first[id]}">{$first['name']}</a></h2>

						<!--商品分类 浮动div 开始-->
						<div class="sublist" style='display:none'>

							<div class="items">
								<strong>选择分类</strong>
								{if:isset($first['second'])}
								{foreach:items = $first['second'] item = $second}
								<dl class="category selected">
									<dt>
										<a href="{url:/site/pro_list/cat/$second[id]}">{$second['name']}</a>
									</dt>

									<dd>
										{if:isset($second['more'])}
										{foreach:items = $second['more'] item = $third}
										<a href="{url:/site/pro_list/cat/$third[id]}">{$third['name']}</a>|
										{/foreach}
										{/if}
									</dd>
								</dl>
								{/foreach}
								{/if}

							</div>

						</div>
						<!--商品分类 浮动div 结束-->

					</li>
				{/foreach}

			</ul>
			<!--总的商品分类-结束-->

		</div>

		<div class="searchbox">
			<form method='get'>
				<input type='hidden' name='controller' value='site' />
				<input type='hidden' name='action' value='search_list' />
				{set:$word = IReq::get('word');}
				<input class="text" type="text" name='word' id="word" autocomplete="off" value="{echo:$word ? $word : '输入关键字...'}" />
				<input class="btn" type="submit" value="商品搜索" onclick="checkInput('word','输入关键字...');" />
			</form>

			<!--自动完成div 开始-->
			<ul class="auto_list" style='display:none'></ul>
			<!--自动完成div 开始-->

		</div>
		<div class="hotwords">热门搜索：
			{query:name=keyword where=hot eq 1 limit=5 order=`order` asc}
			{set:$tmpWord = urlencode($item['word']);}
			<a href="{url:/site/search_list/word/$tmpWord}">{$item['word']}</a>
			{/query}
		</div>
	</div>
	<div class="m_10" id="adHere_1"></div>
	<script language="javascript">
	(new adLoader()).load(1,'adHere_1');
	</script>

	{viewcontent}

	<div class="help m_10">
		<div class="cont clearfix">
			{set:$cat_list=array();}
			{query:name=help_category AS cat where=position_foot eq 1 order=sort ASC,id desc limit=5}
			{set:$cat_list[$item['id']]=$item;}
			{/query}
			{if:count($cat_list)}
				{set:$width=floor(100/count($cat_list))-1;}
			{/if}

			{foreach:items=$cat_list key=$cat_id item=$cat}
			<dl style="width:{$width}%">
     			<dt><a href="{url:/site/help_list/id/$cat[id]}">{$cat['name']}</a></dt>
     			{query:name=help where=cat_id eq $cat_id order=sort ASC,id desc}
					<dd><a href="{url:/site/help/id/$item[id]}">{$item['name']}</a></dd>
				{/query}
      		</dl>
      		{/foreach}
		</div>
	</div>
	{echo:$siteConfig->site_footer_code}
</div>
<script type='text/javascript' src='{theme:javascript/site.js}'></script>
<script type='text/javascript'>
	$('input:text[name="word"]').bind({
		keyup:function(){autoComplete('{url:/site/autoComplete}','{url:/site/search_list/word/@word@}','{$site_config['auto_finish']}');}
	});

	var mycartLateCall = new lateCall(200,function(){showCart('{url:/simple/showCart}')});

	//购物车div层
	$('.mycart').hover(
		function(){
			mycartLateCall.start();
		},
		function(){
			mycartLateCall.stop();
			$('#div_mycart').hide('slow');
		}
	);

	//[ajax]加入购物车
	function joinCart_ajax(id,type)
	{
		var url ="{url:/simple/joinCart/random/@random@/goods_id/@goods_id@/type/@type@}";
		url = url.replace("@random@",Math.random()).replace("@goods_id@",id).replace("@type@",type);
		$.getJSON(url,function(content){
			if(content.isError == false)
			{
				var count = parseInt($('[name="mycart_count"]').html());
				$('[name="mycart_count"]').html(count + 1);
				$('.msgbox').hide();
				alert(content.message);
			}
			else
			{
				alert(content.message);
			}
		});
	}

	//列表页加入购物车统一接口
	function joinCart_list(id)
	{
		var url = "{url:/simple/getProducts/id/@id@}";
		$.get('{url:/simple/getProducts}',{id:id},function(content){
			if(content == '')
			{
				joinCart_ajax(id,'goods');
			}
			else
			{
				$('#product_box_'+id).html(content);
				$('#product_box_'+id).parent().show();
			}
		});
	}
</script>
</body>
</html>
